import 'package:flutter/material.dart';

import 'package:junyeyishu/utils/utils.dart';
import 'package:junyeyishu/widgets/QGWidget.dart';

class QGBulletinItem extends StatefulWidget {
  dynamic data;
  String cate;
  QGBulletinItem({Key? key, required this.data, required this.cate})
      : super(key: key);

  @override
  State<QGBulletinItem> createState() => _QGBulletinWidgetState();
}

class _QGBulletinWidgetState extends State<QGBulletinItem> {
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(12.rpx),
      margin: EdgeInsets.only(bottom: 10.rpx, left: 10.rpx, right: 10.rpx),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(6.rpx),
        color:Color(0XFF232A32),
      ),
      child: Row(
        children: [
          ClipRRect(
              borderRadius: BorderRadius.circular(6.rpx),
              child: QGImage(
                  url: widget.data?["pic"], width: 105.rpx, height: 70.rpx)),
          SizedBox(width: 15.rpx),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  widget.data?["name"] ?? "",
                  style: TextStyle(
                      color: Color(0xFFFFFFFF),
                      fontSize: 16.rpx,
                      fontWeight: FontWeight.normal),
                ),
                SizedBox(height: 12.rpx),
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Container(
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.only(
                            topLeft: Radius.circular(27.rpx),
                            topRight: Radius.circular(27.rpx),
                            bottomLeft: Radius.circular(27.rpx),
                            bottomRight: Radius.circular(27.rpx),
                          ),
                          color: Color(0XFF44FFE2)
                          ),
                      padding: EdgeInsets.symmetric(
                          horizontal: 6.rpx, vertical: 3.rpx),
                      child: Text(
                        widget.cate,
                        style: TextStyle(
                            color: Color(0xFF111111),
                            fontSize: 11.rpx,
                            fontWeight: FontWeight.normal),
                      ),
                    ),
                    Text(
                      widget.data?["created"] ?? "",
                      style: TextStyle(
                          color: Color(0xFF999999),
                          fontSize: 11.rpx,
                          fontWeight: FontWeight.normal),
                    ),
                  ],
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
